<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../lib/ajax.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
    <style>
        #container{
            width: 960px;
            border: 1px solid #333;
            overflow: hidden;
        }
        .item{
            width: 200px;
            border: 1px solid red;
            float: left;
        }
        img{
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="container">
        <div class="item">
            <img src="" alt="">
            <p>hello</p>
        </div>
    </div>
    <script>
       var hot = 'http://47.108.197.28:3000/top/playlist?order=hot'
        $ajax({
            url:hot,
            success:res=>{
                console.log(res)
                var playlists = res.playlists;
                var musics = [];
                playlists.splice(0,8).forEach(item=> {
                    var {name,coverImgUrl,playCount} = item;
                    musics.push({
                        name,
                        coverImgUrl,
                        playCount
                    })
                    var template = `
                            <div id="container">
                                <div class="item">
                                    <img src="${coverImgUrl}" alt="">
                                    <p>${name}</p>
                                    <p>${playCount}</p>
                                    
                                </div>
                            </div>
                    
                    `
                    $("#container").append(template)
                });
              
            }
        })
    </script>
</body>
</html>